<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>我的奖章</title>
    <link rel="stylesheet" type="text/css" href="../css/style.css">
    <link href="../css/css.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="../css/common.css"/>
    <link rel="stylesheet" href="../css/register.css"/>
    <style>
        /*菜单栏*/
        .column{ height:46px; position:relative; background:#fff;}
        .col_img{ width:18px; height:18px; float:left; margin-left:5%; margin-top:14px;}
        .col_img img{ width:18px; height:18px;}
        .column p{ line-height:46px; float:left; color:#191919; font-size:16px; margin-left:14px;}
        /*底部导航*/
        .nav_box{ width:100%; height:51px; position:fixed; left:0; bottom:0; background-color:#fff;}
        .nav_index,.nav_mys,.nav_order,.nav_my{ width:25%; float:left;}
        .nav_box img{ width:18px; height:auto; position:relative; left:50%; margin-left:-9px; margin-top:8px;}
        .nav_box h1{ font-size:12px; text-align:center; color:#65646b; line-height:25px;}
        .nav_box .current_nav{ color:#01aff0;}

        /*//兑换奖章*/
        .message{
            background: none;
            padding-top: 10%;
        }

        .message select {
            width: 87%;
            margin: 0 4%;
            padding: 4% 0 4% 4%;
            margin-bottom: 5%;
        }
        .content form input:not(:nth-child(6)) {
            border: 0;
            margin-bottom: 5%;
        }
        form div{
            width: 83%;
            margin: 0 4%;
            text-align: left;
        }
        form div input[type="radio"]{
            width: auto;
        }
        form div input[type="checkbox"]{
            /*border: red 1px solid;*/
            width: auto;
            margin-top: 8%;
            margin-bottom: 10%;
        }
        form div textarea{
            width: 96%;
            height: 96%;
            outline: none;
            border: 0;
            padding: 2%;
        }
        .code{
            top: 33.475%;
            right: 7.5%;
            background: #21a9f5;
            color: #ffffff;
            padding: 3.635% 5%;
        }
    </style>
</head>

<body>
<div id="reg"></div>
<div class="reg_bg">
    <div class="register">
        <div class="header">兑换奖章
            <div class="header_left" onclick="window.history.go(-1)"><img src="../images/return.png"></div>
        </div>
        <div class="content">
            <form action="">
                <div class="message">
                    <div style="width: 86%; margin-bottom: 0%;text-align: center">
                        <label style="">添加兑换码</label>
                        <input type="text" name="ss_center" value="" style="padding-left: 8px;margin-top: 15px;" placeholder="请输入兑换码" id="code"/>
                    </div>
                    <div style="width: 86%;height: 40px; margin-bottom: 10%;margin-top: 15px;text-align: center">
                        <textarea name="s_center" id="s_center" style="margin-top: 15px;padding-left: 8px;" placeholder="这是我在超市购物2000元时赠送的兑换码" required></textarea>
                    </div>
                    <br>
                    <div style="width: 86%;height: 12vh;margin-top: 15px; margin-bottom: 2%;color: green;">
                        温馨提示：本活动中，用户通过线下纸质券上的兑换码，输入后兑换成奖章，一个兑换码只能用一次。
                    </div>
                </div>
                <input id="quren" class="submit" type="button" value="确认">
            </form>
        </div>
    </div>
</div>
<!--底部导航-->
<div class="nav_box">
    <div class="border_top"></div>
    <div class="nav_index chenge" onclick="document.location='index.html';">
        <img src="../images/activity.png">
        <h1 style=" ">活动奖项</h1>
    </div>
    <div class="nav_mys chenge" onclick="document.location='change.html';">
        <img src="../images/change-l.png">

        <h1 style="color:#01AFF0">兑换奖章</h1>
    </div>
    <div class="nav_my chenge" onclick="document.location='shezhi.html';" >
        <img src="../images/jiang.png">
        <h1>我的奖章</h1>
    </div>
    <div class="nav_order chenge" onclick="document.location='myorder.html';" >
        <img src="../images/user.png">
        <h1>我的奖品</h1>
    </div>
</div>
<script>
	(function (doc, win) {
	  var docEl = doc.documentElement,
		resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
		recalc = function () {
		  var clientWidth = docEl.clientWidth;
		  if (!clientWidth) return;
		  docEl.style.fontSize = 100 * (clientWidth / 750) + 'px';
		};

	  if (!doc.addEventListener) return;
	  win.addEventListener(resizeEvt, recalc, false);
	  doc.addEventListener('DOMContentLoaded', recalc, false);
	})(document, window);
</script>
<script type="text/javascript" src="../js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="../js/layer/2.1/layer.js"></script>
<script type="text/javascript" src="../script/config.js"></script>
<script>
    $("#quren").click(function(){
        var codes=$("#code").val();
        var datas={
            code:codes
        };
        console.log(datas);
        console.log(JSON.stringify(datas));
        $.ajax({
            type: 'POST',
            url: urls+'/redeemCode/frontduihuanjiangzhang',
            data:JSON.stringify(datas),
            contentType: "application/json",
            success: function(req){
                console.log(req);
                if(req.Httpcode==1){
                    layer.msg("成功兑换"+req.count+"枚奖章");
                }else {
                	$("#code").val("");
                	$("#s_center").val("");
                	
                    layer.msg("兑换码有误");
                }
            },
            error:function(){
                layer.msg("请求失败");
            }

        });
    });
//    $(function () {
//        $.ajax({
//            url: '../bin/info_php/userinfo.php',
//            success:function(data){
//                console.log(data);
//                console.log(eval("("+data+")").data[0]);
//                var datas = eval("("+data+")").data[0];
//                (datas.user_img == null ) ? datas.user_img='/travel/Apps/img/logo1.png' : datas.user_img;
//                if(datas.server_id ==  null){
//                    $("#servers").css("display","none");
//                }else {
//                    $("#servers").css("display","block");
//                }
//                $("#username").html(datas.user_name);
//
//                $("#usercenter").html(datas.user_center);
//                (datas.user_img == null ) ? datas.user_img='/travel/Apps/img/head-img.png' : datas.user_img;
//                $("#uimg").attr("src",datas.user_img);
//            }
//
//        });
//    })

</script>

</body>
</html>
